
# 手动遍历迭代器,不使用for
# 手动读取一个文件中的所有行
def manual_iter():
    with open('../temp/pome.txt') as f:
        try:
            while True:
                line = next(f)
                print(line, end = '')
        except StopIteration:
            pass

def demo_1():
    manual_iter()

def demo_2():
    items = [1,2,3]
    it = iter(items)
    print(next(it))
    print(next(it))
    print(next(it))
    print(next(it))

if __name__ == '__main__':
    # demo_1()
    demo_2()